The present invention relates to the methods of controlling communication between a client computer and a server computer, and in particular, methods of controlling the creation and destruction of software objects on a web page.
In recent years there has been a tremendous proliferation of computers connected to a global network known as the Internet. A client computer connected to the Internet can download digital information from special computers called World Wide Web Servers, or simply Web servers, that are also connected to the Internet. Web browser programs running on the client computers translate the downloaded digital information into a visual form called a xe2x80x9cWeb pagexe2x80x9d that is perceptible by a user.
In the past, the content or data contained in a Web page was static and did not change after being displayed in a Web browser program. More recent technology allows the inclusion of program code with the digital information downloaded from Web servers to define software components that execute while a Web page is being viewed with the browser program. The software components provide interactive, dynamic content in Web pages. The components may establish and maintain interactive sessions between a user and remote computers, display animation, or present regularly updated information. Sun Microsystems of Mountain View, Calif., has created a standard programming language and interpreter which is executed and interpreted by the Web browser program. This standard language is referred to as Java and the interpreter is referred to as a Java Virtual Machine (JVM). A Java program which runs in a Web page is referred to as a Java applet. A Java applet is made up of one or more Java objects that provide for the capabilities of the applet. Some Java objects can be considered Java beans or Enterprise Java beans. Java beans and Enterprise Java beans are Java objects that adhere to a specific set of design patterns and rules. If a Java object is a Java bean, it then has more capabilities than a standard Java object within certain development and other environments.
For example, a Stock Ticker Java applet can display current stock prices that are continuously scrolled across a defined area within a Web page that is displayed by a Web browser with an executing JVM. The Stock Ticker Java applet could be made up of two Java objects, one which connects to a stock price information provider (e.g., Nasdaq) and gathers information, and one that would then display this information. If the first object also adhered to the Java bean design patterns and rules, it would be considered a Java bean in addition to being considered a Java object. xe2x80x9cObjectsxe2x80x9d will be used herein to include Java objects, Java applets, Java beans, and Enterprise Java beans.
In addition to displaying static and dynamic information in a Web page, Web browsers and Web servers provide the capability for users to navigate among numerous Web pages along with the capability of returning to a previously viewed Web page. Currently, when a user exits a Web page, the Web browser destroys any and all Java objects contained therein. If the user later returns to a previously viewed Web page, the Web browser must create a new set of Java objects. For objects like the Stock Ticker described above, this is acceptable because a Stock Ticker applet needs to continuously retrieve the latest stock prices and display them, not store old, previously viewed data or preserve the state of data viewed the last time the page was viewed.
In some instances, it is desirable that a Java object preserves a specific state between invocations by the Web browser. For example, a Java object that accesses a host computer preserves a connection with the host and the current host application screen to which the user has navigated. In addition, the Java object preserves any data the user has entered within the host application screen. In the past, Java objects are destroyed when a Web browser exits a Web page by navigating to a different Web page. When a Java applet is destroyed and recreated upon leaving and returning to a Web page, the host connection must be reestablished. The user must then connect to the host, navigate to the appropriate application screen, and reenter any data that was lost.
To eliminate the need to recreate an applet each time a Web page is accessed, it is desirable to provide the ability for a Java object (or a portion thereof), to remain in existence and retain state information when a user leaves a Web page and returns to it. In addition, it is desirable that a Java object retain its link, or correspondence to a particular Web page, and that any reference to the object remain valid or be replaced by an indistinguishable link when a Web browser returns to the page containing the object. It is also desirable to allow the Java object to continue to execute after a user exits from the corresponding Web page.
The present invention is a method of controlling the existence of a Java object that is associated with a Web page in order to reuse the object rather than create a new one when the Web page is revisited. The invention provides a method for allowing an object to register with a persistence manager upon creation, which maintains objects registered with it while the Web page is no longer being viewed.
A Web browser receives one or more instructions that define a Web page. The browser translates the instructions to create a Web page, and invokes any Java objects that reside on the page. The objects then check with the persistence manager, which can be located on the page or within one or more of the objects. If the objects are present in the persistence manager, the objects in the persistence manager are used, rather than creating new objects. If the objects (or some subset thereof) do not exist within the persistence manager, the necessary objects are created and are registered with the persistence manager. The object remains registered with the persistence manager until such time as it no longer needs to persist (as determined by the users needs, not by the Web page being displayed within the Web browser) or until the Web browser or JVM is completely shut down. Registration with the persistence manager prevents the destruction of the object when the Web browser exits from a Web page.
Registration of and return of objects from the persistence manager is accomplished by use of the persistence carrier. The persistence carrier is a Java object that knows how to interface with the persistence manager and how to preserve the state (and even allow the execution) of the objects.
The object passes a predetermined identifier of the desired persistence carrier to the persistence manager. The persistence manager uses this identifier in its determination of whether the desired object already exists. The persistence manager maintains a collection of persistence carriers organized in a static hash table by this identifier. If the desired object exists, it will be contained within a persistence carrier with the given identifier.
As will be readily appreciated from the foregoing description, the present invention provides the ability to maintain the existence of an object associated with a Web page beyond the period of the visit to the Web page. When the Web browser exits the Web page and revisits the page, the object has not been destroyed. The object identifier provides a mechanism to link the object with the specific instruction to create it, so that when the instruction is executed upon revisiting the Web page, a reference to the existing object can be reused. The invention allows a dynamic object to continue executing after exiting from the Web page and upon a revisit to the Web page. In situations where the object maintains a communications session with a host computer, the invention allows the object to continue the communications session without having to reestablish it. The invention also has the advantage that the program code to implement it can accept instructions to either have the object continue beyond exiting from the Web page, or to destroy itself when the Web browser exits the Web page. The instructions can be supplied in the form of HTML instructions in the HTML document (the Web page).